import request from '@/utils/request'
import apis from './'

export function getList (parameter) {
  return request({
    url: apis.TradeList,
    method: 'get',
    params: parameter
  })
}

export function getAddIntent (id) {
  return request({
    url: `${apis.AddIntent}?gid=${id}`,
    method: 'get'
  })
}

export function postAddIntent (id, data) {
  return request({
    url: `${apis.AddIntent}?gid=${id}`,
    method: 'post',
    data: data
  })
}

export function getIntentList (parameter) {
  return request({
    url: apis.IntentList,
    method: 'get',
    params: parameter
  })
}

export function getPurchaseList (parameter) {
  return request({
    url: apis.PurchaseList,
    method: 'get',
    params: parameter
  })
}

export function getTradeList (parameter) {
  return request({
    url: apis.TradeList,
    method: 'get',
    params: parameter
  })
}

export function getAddPurchase () {
  return request({
    url: apis.AddPurchase,
    method: 'get'
  })
}

export function postAddPurchase (data) {
  return request({
    url: apis.AddPurchase,
    method: 'post',
    data: data
  })
}

export function getCheckFeedback (id) {
  return request({
    url: `${apis.CheckFeedback}?filter[purchase_id]=${id}`,
    method: 'get'
  })
}

export function getEditIntention (id) {
  return request({
    url: `${apis.EditIntention}?intent_id=${id}`,
    method: 'get'
  })
}

export function postEditIntention (id, data) {
  return request({
    url: `${apis.EditIntention}?intent_id=${id}`,
    method: 'post',
    data: data
  })
}
